<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<link href="${ctx}/css/main/base.css" rel="stylesheet" type="text/css"/>
<link href="${ctx}/css/main/main.css" rel="stylesheet" type="text/css"/>
<s:head/>
</head>
<body class="m_6" onLoad="startup()">
<div id="main">
  <div><font color="red">${info }</font> </div>
  <form action="${ctx}/user/user_modify.action" method="post">
  <input type="hidden" id="system" name="user.system" value="${user.system }"/>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab_1">
  <caption>修改用户--用户基本信息</caption>
    <tr>
    <td class="w1">用户排序号：</td>
    <td><input name="user.userOrder" id="userOrder" type="text" value="${user.userOrder }" /><div id="errOrder"></div></td>
  </tr>
  <tr>
    <td class="w1">登录帐号：</td>
    <td><input name="user.userLogin" id="userLogin" type="text"  value="${user.userLogin}" readonly="readonly"/><div id="errLogin"></div></td>
  </tr>
  <tr>
    <td class="w1">用户姓名：</td>

    <td><input name="user.userName" id="userName" type="text"  value="${user.userName}"/><div id="errName"></div></td>
  </tr>
  <tr>
    <td class="w1">用户状态：</td>
    <td>
	<input type="radio" name="user.userFlag" value="0" <s:if test="user.userFlag == 0">checked</s:if> />
      有效
        <input type="radio" name="user.userFlag" value="1" <s:if test="user.userFlag == 1">checked</s:if>/>
    无效
        <input type="radio" name="user.userFlag" value="2" <s:if test="user.userFlag == 2">checked</s:if>/>
    未审核
	</td>
  </tr>
  <tr>
    <td class="w1">角色：</td>
    <td> <select name="user.roleId" onchange="selectRole(this);">
                <option value="">--请选择角色--</option>
               <s:iterator value="baseroles" status="role">
                <option value="<s:property value="roleId"/>" <s:if test="user.roleId == roleId">selected</s:if> ><s:property value="roleName"/></option>
                </s:iterator>
                </select></td>
  </tr>
  <tr id="proposalTaketoDept" style="display:none;">
    <td class="w1">请选择交办单位：</td>
    <td><pro:option selectName="user.proposalTaketoDept" optionName="proposal.proposalTaketoDept" value="${user.proposalTaketoDept}"/><div id="errproposalTaketoDept"></div></td>
  </tr>
  <tr id="proposalUndertakeDept" style="display:none;">
    <td class="w1">请选择承办口：</td>
    <td><pro:option selectName="user.proposalUndertakeDept" optionName="proposal.proposalUndertakeDept" value="${user.proposalUndertakeDept}"/><div id="errproposalUndertakeDept"></div></td>
  </tr>
  <tr id="proposalZhuban" style="display:none;">
    <td class="w1">请选择主办：</td>
    <td><input id="proposalSponsor" name="proposal.proposalSponsor" type="text" size="20" maxLength="14" value="${proposal.proposalSponsor}" readOnly style="color:gray;"/>
    <input type="hidden" id="proposalSponsorId" name="user.proposalSponsorId" value="${user.proposalSponsorId}"/>
    	<input type="button" onclick="choose('${ctx}/proposal/proposal!chooseProposalDept.action', 'proposalSponsorId','proposalSponsor');" value="+添加" class="log_f">
    	<input type="button" onclick="deleteChoose('proposalSponsorId','proposalSponsor');" value="-清空" class="log_f">
    </td>
  </tr>
  <tr id="proposalHuiban" style="display:none;">
    <td class="w1">请选择会办：</td>
    <td><input id="proposalNeeddo" name="proposal.proposalNeeddo" type="text" size="14" maxLength="20" value="${proposal.proposalNeeddo}" readOnly style="color:gray;"/>
    <input type="hidden" id="proposalNeeddoId" name="proposal.proposalNeeddoId" value="${proposal.proposalNeeddoId}"/>
    	<input type="button" onclick="choose('${ctx}/proposal/proposal!chooseProposalDept.action', 'proposalNeeddoId','proposalNeeddo');" value="+添加" class="log_f">
    	<input type="button" onclick="deleteChoose('proposalNeeddoId','proposalNeeddo');" value="-清空" class="log_f">
    </td>
  </tr>
  <tr>
    <td class="w1">部门：</td>
    <td> <select name="user.deptId">
                <option value="">--请选择部门--</option>
               <s:iterator value="departments" status="depart">
                <option value="<s:property value="deptId"/>" <s:if test="user.deptId == deptId">selected</s:if> >${deptNames}</option>
                </s:iterator>
                </select></td>
  </tr>
  <tr>
    <td class="right">系统权限：</td>
    <td>
    提案系统<input type="checkbox" name="systemCheckbox" value="0"/>
    社情民意系统<input type="checkbox" name="systemCheckbox" value="1"/>
    留言系统<input type="checkbox" name="systemCheckbox" value="2"/>
    </td>
  </tr>
   </table><br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab_1">
  <caption>新建用户--用户可自定义选项</caption>
  <tr>
    <td class="right">身份证号：</td>
    <td><input type="text" id="userCard"  name="user.userCard" value="${user.userCard}" onblur="showBirthday(document.all.userCard.value);" class="fl_l"/><div id="code"></div></td>
  </tr>
  <tr>
    <td class="w1">性别：</td>
    <td><pro:option selectName="user.userSex" optionName="userSex" value="${user.userSex}" id="userSex"/></td>
  </tr>
  <tr>
    <td class="w1">手机号码：</td>
    <td><input name="user.userPhone" id="userPhone" type="text" value="${user.userPhone }" /><div id="errPhone"></div></td>
  </tr>
  <tr>
    <td class="w1">电子邮箱：</td>
    <td><input name="user.userEmail" id="userEmail" type="text" value="${user.userEmail }" /><div id="errEmail"></div></td>
  </tr>
  <tr>
    <td class="w1">界别：</td>
    <td><pro:option selectName="user.jieBie" optionName="jieBie" value="${user.jieBie}"/></div></td>
  </tr>
  <tr>
    <td class="right">备注：</td>
    <td><textarea name="user.userMemo" id="userMemo" class="zc_textarea" >${user.userMemo}</textarea></td>
  </tr>
  <tr>
  <font color="red"><div id="ERROR">${ERROR }</div></font>
    <td colspan="2"><div class="zc_but2">
    <input type="hidden" name="user.userId" value="${user.userId}"/>
  <input type="hidden" name="user.userPwd" value="${user.userPwd}"/>
  <input type="hidden" name="user.userSpell" value="${user.userSpell}"/>
	<input type="button" onclick="modifyUser();"  value="修 改" class="log_f zc_b">
	<input type="button" onclick="javascript:reset();" value="重置" class="log_f zc_b">
	<input type="button" onclick="javascript:history.go(-1);" value="返回" class="log_f zc_b">
	</div></td>
    </tr>
  </table>
</div>
</form>
</body>
</html>

<script type="text/javascript" src="${ctx}/scripts/commons/validation.js"></script>
<script type="text/javascript" src="${ctx}/scripts/sys/calendar.js"></script>
<script src="${ctx}/scripts/datepicker/WdatePicker.js"></script>

<script type="text/javascript">
function selectRole(obj) {
	document.getElementById("proposalUndertakeDept").style.display = "none";
	document.getElementById("proposalZhuban").style.display = "none";
	document.getElementById("proposalHuiban").style.display = "none";
	if (obj.value == '4') {
		document.getElementById("proposalUndertakeDept").style.display = "block";
	} else if (obj.value == '6') {
		document.getElementById("proposalZhuban").style.display = "block";
	} else if (obj.value == '7') {
		document.getElementById("proposalHuiban").style.display = "block";
	}
}
</script>
<script type="text/javascript">

function startup() {
	setCheckboxCheckedString("systemCheckbox", '${user.system}');
	var obj = {};
	obj.value = '${user.roleId}';
	selectRole(obj);
}
<!--
function modifyUser(){


var userLogin = document.getElementById("userLogin").value;
var userOrder = document.getElementById("userOrder").value;
var userName = document.getElementById("userName").value;
var userPhone = document.getElementById("userPhone").value;
var userEmail = document.getElementById("userEmail").value;

if(userLogin.length == 0){
document.getElementById("errLogin").innerHTML = "<font color='red'> 帐号不能为空!</font>";
return false;
}
if(hasSpecialChart(userLogin)){
document.getElementById("errLogin").innerHTML = "<font color='red'> 帐号不能有特殊字符!</font>";
return false;
}
if(userLogin.length > 20){
document.getElementById("errLogin").innerHTML = "<font color='red'> 帐号长度不能大于20!</font>";
return false;
}
if(userOrder.length == 0){
document.getElementById("errOrder").innerHTML = "<font color='red'> 用户排序号不能为空!</font>";
return false;
}
if(userOrder.length > 4){
document.getElementById("errOrder").innerHTML = "<font color='red'> 用户排序号长度不能大于4!</font>";
return false;
}
if(isNaN(parseInt(userOrder))){
document.getElementById("errOrder").innerHTML = "<font color='red'> 排序必须是数字!</font>";
return false;
}
if(userName.length == 0){
document.getElementById("errName").innerHTML = "<font color='red'> 用户姓名不能为空!</font>";
return false;
}
if(userName.length > 0 && hasSpecialChart(userName)){
document.getElementById("errName").innerHTML = "<font color='red'> 用户名不能有特殊字符!</font>";
return false;
}
if(userName.length > 20){
document.getElementById("errName").innerHTML = "<font color='red'> 用户姓名长度不能大于20!</font>";
return false;
}
var roleId = document.getElementById("user.roleId").value;
		if (roleId == "3") {
			var proposalTaketoDept = document.getElementById("user.proposalTaketoDept").value;
			if (proposalTaketoDept == null) {
				document.getElementById("errproposalTaketoDept").innerHTML = "<font color='red'> 交办单位不能为空!</font>";
				return false;
			}
			document.getElementById("user.proposalUndertakeDept").value = "";
		}
		if (roleId == "4") {
			var proposalUndertakeDept = document.getElementById("user.proposalUndertakeDept").value;
			if (proposalUndertakeDept == null) {
				document.getElementById("errproposalUndertakeDept").innerHTML = "<font color='red'> 承办单位不能为空!</font>";
				return false;
			}
			document.getElementById("user.proposalTaketoDept").value = "";
		}
if(userPhone.length > 20){
document.getElementById("errPhone").innerHTML = "<font color='red'> 手机号码长度不能大于20!</font>";
return false;
}
if(userPhone.length > 0 && !isAllNumber(userPhone)){
document.getElementById("errPhone").innerHTML = "<font color='red'> 正确填写手机号码!</font>";
return false;
}
if(userEmail.length > 50){
document.getElementById("errEmail").innerHTML = "<font color='red'> 电子邮箱长度不能大于50!</font>";
return false;
}
if(userEmail.length > 0 && isEmail(userEmail) == false){
document.getElementById("errEmail").innerHTML = "<font color='red'> 正确填写电子邮箱!</font>";
return false;
}
setElementByIdValue("system", getCheckboxCheckedString("systemCheckbox"));
document.forms[0].submit();
}


//根据身份证，获得性别和出生年月
　　 function showBirthday(val)
　　 {
 	if((/^\d{18}|\d{17}[xX]{1}|\d{15}$/).test(val)){

		var birthdayValue;
	　　 if(15==val.length)
	　　 { //15位身份证号码
	　　 birthdayValue = val.charAt(6)+val.charAt(7);
	　　 if(parseInt(birthdayValue)<10)
	　　 {
	　　 birthdayValue = '20'+birthdayValue;
	　　 }
	　　 else
	　　 {
	　　 birthdayValue = '19'+birthdayValue;
	　　 }
	　　 birthdayValue=birthdayValue+'-'+val.charAt(8)+val.charAt(9)+'-'+val.charAt(10)+val.charAt(11);
	　　 if(parseInt(val.charAt(14)/2)*2!=val.charAt(14))
	    document.getElementById("user.userSex").value=0;
	    else
		document.getElementById("user.userSex").value=1;
	　　 }
	　　 if(18==val.length)
	　　 { //18位身份证号码
	　　 birthdayValue=val.charAt(6)+val.charAt(7)+val.charAt(8)+val.charAt(9)+'-'+val.charAt(10)+val.charAt(11) 
	　　 +'-'+val.charAt(12)+val.charAt(13);
	　　 if(parseInt(val.charAt(16)/2)*2!=val.charAt(16))
	    document.getElementById("user.userSex").value=0;
	    else
		 document.getElementById("user.userSex").value=1;
	　　 }
	}else{
		document.getElementById("code").innerHTML = "<font color='red'> 请正确输入身份证号码!</font>";
	}
　　 }


	
	function chooseRoles(id,name){
	
		var names ="";
        var ids ="";
		var item=window.showModalDialog("${ctx}/user/user!chooseRoles.action?time="+new Date().getTime(),window,"scroll:no;dialogHeight=420px;dialogWidth=420px;");
	    if(item != null){
	    for(var i=0;i<item.length;i++)
	       {
	          names += item[i][0]+",";
	          ids += item[i][1]+",";
	       }
      
    	document.getElementById(id).value = ids;
    	document.getElementById(name).value = names;
	
	}
	}
	
	function deleteChoose(id,name){
		document.getElementById(id).value = "";
    	document.getElementById(name).value = "";
	}
	
	
	function chooseDeparts(id,name){
	
		var names ="";
        var ids ="";
		var item=window.showModalDialog("${ctx}/user/user!chooseDepts.action?time="+new Date().getTime(),window,"scroll:no;dialogHeight=420px;dialogWidth=420px;");
	    if(item != null){
	    for(var i=0;i<item.length;i++)
	       {
	          names += item[i][0]+",";
	          ids += item[i][1]+",";
	       }
      
    	document.getElementById(id).value = ids;
    	document.getElementById(name).value = names;
	}
	}
//-->
</script>